package com.tingyun.sign.core.repository;

import java.util.Date;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

import com.tingyun.sign.core.entity.RegLog;

@Repository("regLogDao")
public interface RegLogDao extends PagingAndSortingRepository<RegLog, Integer>, JpaSpecificationExecutor<RegLog> {
	/**
	 * @author 董吉岩
	 * @date 2014年12月9日 下午5:36:29
	 * @param ip
	 * @param sDate
	 * @param eDate
	 * @return
	 */
	@Query(value="SELECT nvl(sum(t.phonecount),0) FROM SS_REG_LOG T WHERE T.IP =? AND T.PHONECODETIME Between ? and ?",nativeQuery=true)
	public int getRandomCountByIp(String ip,Date sDate,Date eDate);
}
